package fun.taostool.common.constant;


import java.text.MessageFormat;

/**
 * @Description: 返回码
 * @Author: Chensn
 * @Date: 2024/10/31
 */
public enum RespCodeEnum {

    /**
     * ==========系统相关 1000-1100==============
     * ==========业务相关 1100-1500==============
     */

    // ==========系统相关 1000-1100==============
    SysErr("1000", "SysErr"),
    FILE_PARSING_FAILED("1001", "文件上传失败"),

     // ==========业务相关 1100-1500==============
    BusinessErr("11000", "BusinessErr"),



    ;

    private String msgCode;
    private String msgDes;

    RespCodeEnum(String msgCode, String msgDes) {
        this.msgCode = msgCode;
        this.msgDes = msgDes;
    }

    public String getMsgCode() {
        return msgCode;
    }

    public String getMsgDes() {
        return msgDes;
    }

    /**
     * 使用占位符{num} 进行替换
     *
     * @param placeholders 替换的参数
     *                     eg:
     *                     des: 用户{0}无法操作, 申请单{1}已存在。
     *                     placeholders: "admin", "CGS2.2.12022"
     */
    public RespCodeEnum fmtDes(Object... placeholders) {
        this.msgDes = MessageFormat.format(this.msgDes, placeholders);
        return this;
    }
}
